<template>
  <div>
    <div v-if="!!isLogin">
      <Navbar />
      <h1>123213</h1>
    </div>
    <div v-else class="notLogin">
      <p class="welcome">欢迎来到xx商城</p>
      <p class="look-more">想看更多?立刻登录</p>
      <button class="cta" @click="goLogin">
        <span class="hover-underline-animation"> 去登录 </span>
        <svg
          viewBox="0 0 46 16"
          height="10"
          width="30"
          color="#1989fa"
          xmlns="http://www.w3.org/2000/svg"
          id="arrow-horizontal"
        >
          <path
            transform="translate(30)"
            d="M8,0,6.545,1.455l5.506,5.506H-30V9.039H12.052L6.545,14.545,8,16l8-8Z"
            data-name="Path 10"
            id="Path_10"
          ></path>
        </svg>
      </button>
    </div>
  </div>
</template>

<script setup>
import Navbar from '@/components/navBar/Navbar.vue';
import { storeToRefs } from 'pinia';
import useUsertore from '@/stores/user';
import { useRouter } from 'vue-router';
const router = useRouter();
const userStore = useUsertore();
const { isLogin } = storeToRefs(userStore);
const goLogin = () => {
  router.push({ path: '/login' });
};
</script>

<style lang="scss" scoped>
.notLogin {
  width: 100vw;
  margin-top: 30vh;
  text-align: center;
  .welcome {
    font-size: 5vw;
    color: #1989fa;
  }
  .look-more {
    margin-top: 5vw;
    font-size: 5vw;
    color: #1989fa;
  }
}
.cta {
  margin-top: 5vw;
  border: none;
  background: none;
  cursor: pointer;
}

.cta span {
  padding-bottom: 7px;
  letter-spacing: 4px;
  font-size: 5vw;
  padding-right: 15px;
  text-transform: uppercase;
}

.cta svg {
  transform: translateX(-8px);
  transition: all 0.3s ease;
  fill: #1989fa;
}

.cta:hover svg {
  transform: translateX(0);
}

.cta:active svg {
  transform: scale(0.9);
}

.hover-underline-animation {
  position: relative;
  color: #1989fa;
  padding-bottom: 20px;
}

.hover-underline-animation:after {
  content: '';
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #1989fa;
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}

.cta:hover .hover-underline-animation:after {
  transform: scaleX(1);
  transform-origin: bottom left;
}
</style>
